﻿using System.Collections.Generic;

namespace Utility3D
{
    public class ListDictionary<TKey, TValue>
    {
        private readonly Dictionary<TKey, List<TValue>> _dictionary = new Dictionary<TKey, List<TValue>>();

        public List<TValue> this[TKey key]
        {
            get
            {
                if (!_dictionary.ContainsKey(key))
                    _dictionary[key] = new List<TValue>();
                var list = _dictionary[key];
                return list;
            }
        }

        public void Remove(TKey key)
        {
            _dictionary.Remove(key);
        }
    }
}